<!-- 新增编辑督办数据 -->
<template>
  <a-modal
    :maskClosable="false"
    :title="title"
    :width="width"
    placement="right"
    :closable="false"
    @close="close"
    :visible="visible">
    <SupervisionListForm style="padding-bottom: 20px;" ref="realForm" @ok="submitCallback" @unButtonDisable="unButtonDisable" :disabled="disableSubmit" normal></SupervisionListForm>
    <div class="drawer-footer" slot="footer">
      <a-button @click="handleOk" type="primary" style="margin-bottom: 0; margin-right: 20px;">保存</a-button>
      <a-popconfirm title="确定关闭弹窗吗?" @confirm="handleCancel" :getPopupContainer="(node) => node.parentNode">
        <a-button style="margin-bottom: 0;">关闭</a-button>
      </a-popconfirm>
    </div>
  </a-modal>
</template>

<script>

  import SupervisionListForm from './SupervisionListForm'
  import { ModalClickMixin } from '@/mixins/ModalClickMixin'
  export default {
    name: 'SupervisionListModal',
    components: {
      SupervisionListForm,
    },
    
    methods: {
      // 点击保存
      handleOk () {
        this.buttonDisable = true;
        this.$refs.realForm.submitForm();
      },

      add (value) {
      this.buttonDisable = false
      this.visible = true
      this.$nextTick(() => {
        this.$refs.realForm.add(value);
      })
    },
    edit (record) {
      this.buttonDisable = false
      this.visible = true
      this.$nextTick(() => {
        this.$refs.realForm.edit(record);
      });
    },
    close () {
      this.$emit('close');
      this.visible = false;
    },
    submitCallback(record) {
      this.$emit('ok', record);
      this.visible = false;
    },
    handleCancel () {
      this.close()
    },
    // 点击发起流程
    beginProcess () {
      this.buttonDisable = true;
      this.$refs.realForm.submitForm('submit');
    },
    unButtonDisable () {
      this.buttonDisable = false
    }
    },
    mixins: [ModalClickMixin]
  }
</script>

<style lang="less" scoped>
/** Button按钮间距 */
  .ant-btn {
    margin-left: 30px;
    margin-bottom: 30px;
    float: right;
  }
  .drawer-footer{
    position: absolute;
    bottom: -8px;
    width: 100%;
    border-top: 1px solid #e8e8e8;
    padding: 10px 16px;
    text-align: right;
    left: 0;
    background: #fff;
    border-radius: 0 0 2px 2px;
    z-index: 100;
  }
</style>
